(global.webpackJsonp = global.webpackJsonp || []).push([ [ "xg_o2o/coupon/coupon" ], {
    "5ef8": function(e, n, t) {
        "use strict";
        (function(e) {
            Object.defineProperty(n, "__esModule", {
                value: !0
            }), n.default = void 0;
            var t = {
                data: function() {
                    return {
                        bgColor: "",
                        textColor: "",
                        graceFullLoading: !0,
                        currentIndex: 0,
                        tabs: [ "领取优惠券", "已领优惠券" ],
                        mainHeight: 0,
                        topHeight: 0,
                        coupons: [ [], [] ],
                        page: [ 1, 1 ],
                        pageMore: [ 0, 0 ],
                        clickNum: [ 0, 0 ],
                        loadingTypes: [ 0, 0 ],
                        showBack: !1,
                        tabBar: {},
                        currentCur: 0,
                        couponcode: "",
                        couponBTn: !1
                    };
                },
                onLoad: function() {
                    var n = getCurrentPages();
                    this.showBack = n.length > 1;
                    var t = this.$systemInfo.info();
                    this.topHeight = t.screenHeight - t.statusBarHeight - 44 - t.iPhoneXBottomHeightPx - e.upx2px(150), 
                    this.mainHeight = this.topHeight - e.upx2px(100), this.getCoupon("all", 1);
                },
                methods: {
                    formSubmit: function(n) {
                        var t = this;
                        if (this.couponcode = n.detail.value.couponcode, this.couponBTn = !0, this.couponcode) {
                            e.showLoading({
                                title: "兑换中",
                                mask: !0
                            });
                            var o = this.$xSign.sign("v4coupon");
                            this.$xRequest.request({
                                url: "entry/wxapp/v4coupon",
                                data: {
                                    xgsign: o,
                                    code: this.couponcode,
                                    op: "getcode"
                                },
                                success: function(n) {
                                    e.hideLoading(), e.showModal({
                                        title: "提示",
                                        content: n.data.message,
                                        success: function(e) {
                                            e.confirm ? (t.couponBTn = !1, t.page = [ 1, 1 ], t.loadingTypes = [ 0, 0 ], t.pageMore = [ 0, 0 ], 
                                            t.clickNum = [ 0, 0 ], t.coupons = [ [], [] ], t.couponcode = "", 1 == t.currentIndex ? t.getCoupon("user") : t.getCoupon("all")) : e.cancel && console.log("用户点击取消");
                                        }
                                    });
                                },
                                fail: function(n) {
                                    e.showToast({
                                        title: n.data.message,
                                        icon: "none",
                                        mask: !0
                                    }), t.couponcode = "", t.couponBTn = !1;
                                }
                            });
                        } else e.showToast({
                            title: "请输入兑换码",
                            duration: 1200,
                            icon: "none",
                            mask: !0
                        }), this.couponBTn = !1;
                    },
                    useIt: function(n) {
                        1 == n.currentTarget.dataset.status && e.navigateTo({
                            url: "/xg_o2o/index/index"
                        });
                    },
                    getIt: function(n) {
                        var t = this, o = n.currentTarget.dataset.status;
                        if (2 != o) {
                            var r = 1 == o ? "您已领过了" : "优惠券被抢光了";
                            return e.showToast({
                                title: r,
                                duration: 2e3,
                                icon: "none",
                                mask: !0
                            }), setTimeout(function() {
                                e.hideToast();
                            }, 1800), !1;
                        }
                        e.showToast({
                            title: "领取中",
                            duration: 2e3,
                            icon: "none",
                            mask: !0
                        });
                        var a = n.currentTarget.id, i = this.$xSign.sign("v4coupon");
                        this.$xRequest.request({
                            url: "entry/wxapp/v4coupon",
                            data: {
                                xgsign: i,
                                id: a,
                                op: "draw"
                            },
                            success: function(n) {
                                e.hideToast();
                                var o = JSON.parse(t.$Decrypt(n.data.data));
                                1 != o.info && 0 != o.info || (e.showToast({
                                    title: n.data.message,
                                    duration: 2e3,
                                    icon: "none",
                                    mask: !0
                                }), setTimeout(function() {
                                    e.hideToast(), t.page = [ 1, 1 ], t.loadingTypes = [ 0, 0 ], t.pageMore = [ 0, 0 ], 
                                    t.clickNum = [ 0, 0 ], t.coupons = [ [], [] ], t.getCoupon("all", 1);
                                }, 1200));
                            }
                        });
                    },
                    navChange: function(e) {
                        this.currentIndex = e;
                    },
                    swiperChange: function(e) {
                        var n = e.detail.current;
                        this.currentIndex = n, 0 == this.clickNum[this.currentIndex] && this.getCoupon("user");
                    },
                    scrollend: function(e) {
                        if (2 == this.loadingTypes[this.currentIndex] || 4 == this.loadingTypes[this.currentIndex]) return !1;
                        this.getCoupon("all");
                    },
                    scrollendUser: function(e) {
                        if (2 == this.loadingTypes[this.currentIndex] || 4 == this.loadingTypes[this.currentIndex]) return !1;
                        this.getCoupon("user");
                    },
                    getCoupon: function(n, t) {
                        var o = this;
                        if (1 == this.pageMore[this.currentIndex]) return 1 == t ? this.graceFullLoading = !1 : e.hideLoading(), 
                        !1;
                        this.graceFullLoading = !1, 1 == t ? this.graceFullLoading = !0 : e.showLoading({
                            title: "数据加载中"
                        });
                        var r = this.$xSign.sign("v4coupon");
                        this.$xRequest.request({
                            url: "entry/wxapp/v4coupon",
                            data: {
                                page: this.page[this.currentIndex],
                                xgsign: r,
                                op: n
                            },
                            success: function(n) {
                                var r = JSON.parse(o.$Decrypt(n.data.data));
                                o.bgColor = r.bgColor, o.textColor = r.textColor, o.tabBar = r.tabbar, o.currentCur = r.currentCur, 
                                0 == n.data.errno && (1 == t ? o.graceFullLoading = !1 : e.hideLoading(), 0 == r.info ? (r.itemlist.length > 0 && (1 == o.page[o.currentIndex] ? (o.coupons.splice(o.currentIndex, 1, r.itemlist), 
                                r.count < r.pagesize ? (o.pageMore[o.currentIndex] = 1, o.loadingTypes.splice(o.currentIndex, 1, 2)) : o.loadingTypes.splice(o.currentIndex, 1, 0)) : o.coupons[o.currentIndex] = o.coupons[o.currentIndex].concat(r.itemlist), 
                                r.count < r.pagesize ? (o.pageMore[o.currentIndex] = 1, o.loadingTypes.splice(o.currentIndex, 1, 2)) : o.loadingTypes.splice(o.currentIndex, 1, 0)), 
                                o.clickNum[o.currentIndex]++, o.page[o.currentIndex]++) : (o.pageMore[o.currentIndex] = r.info, 
                                o.loadingTypes.splice(o.currentIndex, 1, 2)));
                            }
                        });
                    }
                }
            };
            n.default = t;
        }).call(this, t("543d").default);
    },
    "77c9": function(e, n, t) {
        "use strict";
        t.r(n);
        var o = t("5ef8"), r = t.n(o);
        for (var a in o) "default" !== a && function(e) {
            t.d(n, e, function() {
                return o[e];
            });
        }(a);
        n.default = r.a;
    },
    b68b: function(e, n, t) {
        "use strict";
        (function(e) {
            function n(e) {
                return e && e.__esModule ? e : {
                    default: e
                };
            }
            t("4e1e"), n(t("66fd")), e(n(t("e519")).default);
        }).call(this, t("543d").createPage);
    },
    d060: function(e, n, t) {},
    d1bd: function(e, n, t) {
        "use strict";
        var o = t("d060");
        t.n(o).a;
    },
    e215: function(e, n, t) {
        "use strict";
        t.d(n, "b", function() {
            return r;
        }), t.d(n, "c", function() {
            return a;
        }), t.d(n, "a", function() {
            return o;
        });
        var o = {
            gracePage: function() {
                return t.e("graceUI/components/gracePage").then(t.bind(null, "1915"));
            },
            graceFullLoading: function() {
                return t.e("graceUI/components/graceFullLoading").then(t.bind(null, "7669"));
            },
            graceNavBar: function() {
                return t.e("graceUI/components/graceNavBar").then(t.bind(null, "56e2"));
            },
            graceEmptyNew: function() {
                return t.e("graceUI/components/graceEmptyNew").then(t.bind(null, "fb2f"));
            },
            graceCoupons: function() {
                return t.e("graceUI/components/graceCoupons").then(t.bind(null, "6be9"));
            },
            graceLoading: function() {
                return t.e("graceUI/components/graceLoading").then(t.bind(null, "93a5"));
            },
            xmgTabBar: function() {
                return t.e("components/xmgTabBar/xmgTabBar").then(t.bind(null, "cfe5"));
            }
        }, r = function() {
            var e = this, n = (e.$createElement, e._self._c, Object.keys(e.tabBar));
            e.$mp.data = Object.assign({}, {
                $root: {
                    g0: n
                }
            });
        }, a = [];
    },
    e519: function(e, n, t) {
        "use strict";
        t.r(n);
        var o = t("e215"), r = t("77c9");
        for (var a in r) "default" !== a && function(e) {
            t.d(n, e, function() {
                return r[e];
            });
        }(a);
        t("d1bd");
        var i = t("f0c5"), c = Object(i.a)(r.default, o.b, o.c, !1, null, null, null, !1, o.a, void 0);
        n.default = c.exports;
    }
}, [ [ "b68b", "common/runtime", "common/vendor" ] ] ]);